<?php

use app\common\model\Order;

function getOrderCount($uid, $status, $field = 'uid')
{
    return Order::where([$field => $uid, 'status' => $status])->count();
}

function getProductOrderFriendly($value)
{
    return match ($value) {
        1 => '商品待支付',
        2 => '商品已支付，等待商家发货',
        3 => '商家已发货，等待确认收货',
        5 => '已完成',
        6 => '订单已取消',
        default => ''
    };
}
